<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>18、表单属性指令-v-model.html</title>
</head>
<body>

<div id="app">
    **v-model 会忽略所有表单元素的 value、checked、selected attribute 的初始值。它将始终将当前活动实例的数据作为数据来源。你应该通过
    JavaScript 在组件的 data 选项中声明初始值。*
    <input type="text" @input="inputevent" :value="username">
    <input type="text" v-model="username">
    <h1>你输入的值是：{{username}}</h1>
</div>

<script src="js/vue.global.js"></script>
<script>
    var vm = Vue.createApp({
        created(){
        },
        data() {
            return {
                username:"yykk"
            }
        },
        methods:{
            inputevent($event){
                this.username = $event.target.value;
            }
        }

    }).mount("#app");
</script>

</body>
</html>